package com.njwb.day09.exception;

public class Test02 {
    public static void main(String[] args) {

        String str= null ;

        //NullPointerException
        //str.equals("abc");


//        int[] array = new int[4];
//        System.out.println(array[4]);


        //本质上是一只猫
        Pet pet  = new Cat();
        //

        if(pet instanceof  Cat ) {
            Cat c = (Cat) pet;
            System.out.println(c);
        }else if(pet instanceof  Dog ) {
            //将猫转成狗
            Dog d = (Dog) pet;
            System.out.println(d);
        }




//        不在一颗继承树上，编译直接报错
//        Integer i = 10 ;
//        String message= (String)i;




    }
}
